﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using Entity;
using BAL;
using Common;
using System.Text;
namespace Web
{
    public partial class admininfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!UserValidate.CheckLogin(this.Request, "MasterQuesType"))
            {
                Response.Write("<script type=\"text/javascript\">top.location.href='login.aspx';</script>");
                Response.Redirect("login.aspx");
                Response.End();
            }
            if (!IsPostBack)
            {
                LoadQuesType();
                LoadDiffic();
                LoadAssess();
                LoadCognitiveLevel();
            }
        }

        protected void LoadQuesType()
        {
            IList<QuesTypeInfo> quesTypeInfo = QuesType.GetQuesTypeInfos(0, 0);
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='list2'>");
            foreach (QuesTypeInfo info in quesTypeInfo)
            {
                sb.Append("<li>");
                sb.Append(info.Name);
                sb.Append("<span>[<a href=\"javascript:ShowIframe('PostQuesType.aspx?editid=");
                sb.Append(info.Id);
                sb.Append("','编辑题目类型',600,50);\">编辑</a> | <a href=\"javascript:ShowConfirm('PostQuesType.aspx?delid=");
                sb.Append(info.Id);
                sb.Append("','删除题目类型将一并删除此类型已录入的所有试题，是否继续？',150,60)\">删除</a>]</span>");
                sb.Append("</li>");
                
            }
            sb.Append("</ul>");
            QuesTypeList.Text = sb.ToString();
        }

        protected void LoadDiffic()
        {
            IList<DifficInfo> difficInfo = Diffic.GetDifficInfos(0, 0);
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='list2'>");
            foreach (DifficInfo info in difficInfo)
            {
                sb.Append("<li>");
                string Diffname = info.Name;
                sb.Append(Diffname);
                sb.Append("<span>[<a href=\"javascript:ShowIframe('PostDiffic.aspx?editid=");
                sb.Append(info.Id);
                sb.Append("','编辑难度级别',600,50);\">编辑</a> | <a href=\"javascript:ShowConfirm('PostDiffic.aspx?delid=");
                sb.Append(info.Id);
                sb.Append("','删除难度级别将一并删除此级别已录入的所有试题，是否继续？',150,60)\">删除</a>]</span>");
                sb.Append("</li>");

            }
            sb.Append("</ul>");
            DifficList.Text = sb.ToString();
        }

        protected void LoadAssess()
        {
            IList<AssessInfo> assessInfo = Assess.GetList();
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='list2'>");
            foreach (AssessInfo info in assessInfo)
            {
                sb.Append("<li>");
                sb.Append(info.Name);
                sb.Append("级区分度<span>[<a href=\"javascript:ShowIframe('PostAssess.aspx?editid=");
                sb.Append(info.Id);
                sb.Append("','编辑区分度',600,50);\">编辑</a> | <a href=\"javascript:ShowConfirm('PostAssess.aspx?delid=");
                sb.Append(info.Id);
                sb.Append("','删除区分度将一并删除此级别已录入的所有试题，是否继续？',150,60)\">删除</a>]</span>");
                sb.Append("</li>");

            }
            sb.Append("</ul>");
            AssessList.Text = sb.ToString();
        }

        protected void LoadCognitiveLevel()
        {
            IList<CognitiveLevelInfo> cognitiveLevelInfo = CognitiveLevel.GetList(0);
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='list2'>");
            foreach (CognitiveLevelInfo info in cognitiveLevelInfo)
            {
                sb.Append("<li>");
                sb.Append("<a href=\"javascript:ShowIframe('PostCognitiveLevelshow.aspx?parentid=" + info.Id + "','认知维度类别',600,300);\">" + info.Name + "</a>");
                sb.Append("<span>[");
                sb.Append("<a href=\"javascript:ShowIframe('PostCognitiveLevelType.aspx?parentid=" + info.Id + "','认知维度类别',600,50);\">添加认知类别</a> | ");
                sb.Append("<a href=\"javascript:ShowIframe('PostCognitiveLevel.aspx?editid=" + info.Id + "','编辑认知层次',600,50);\">编辑</a> | ");
                sb.Append("<a href=\"javascript:ShowConfirm('PostCognitiveLevel.aspx?delid=" + info.Id + "','删除认知层次将一并删除此级别已录入的所有试题，是否继续？',150,60)\">删除</a>");
                sb.Append("]</span>");
                sb.Append("</li>");
            }
            sb.Append("</ul>");
            CognitiveLevelList.Text = sb.ToString();
        }
    }
}
